namespace WebinatorTest.IntegrationTests
{
    using NUnit.Framework;
    using Webinator;
    using Webinator.Enums;

    [TestFixture]
    public class AuthAlerts
    {
        [Test]
        public void SwitchToTest()
        {
            var config = new Config
            {
                LogScreenshots = false,
                LogLevel = Config.AvailableLogLevels.None,
                BaseUrl = "http://www.ancestry.com/facebook",
                Browser = Config.AvailableBrowsers.FirefoxSsl,
                Framework = Config.AvailableFrameworks.WebDriver,
                HighlightElements = true,
            };

            var web = WebManagerFactory.CreateInstance(config);

            web.Wait(WaitUntil.Displayed(LocateBy.Css("span.fb_button_text")));

            web.Click(LocateBy.Css("span.fb_button_text"));

            web.SwitchToWindow(SwitchBy.Url, Comparison.Contains, "facebook.com/login.php");
            web.SendKeys(LocateBy.Id("email"), "test1.value@gmail.com");
            web.SendKeys(LocateBy.Id("pass"), "value@123");
            web.Click(LocateBy.Id("loginbutton"), WaitUntil.WindowDisappears());
            web.SwitchToMainWindow();
            web.CloseBrowser();
        }
    }
}